void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor
  pinMode(PC13, OUTPUT);
}

//void loop() {
//  // put your main code here, to run repeatedly:
//  int responsedata=Serial.read(); // STM32 RECV数据
//  if(responsedata != -1){
//
//      Serial.write(responsedata); // STM32 发送数据
//      Serial.print(",");
//      Serial.println(responsedata);
//    }
//
//  delay(100);
//}

//void loop(){
//  Serial.write(66); // STM32 一直发 6 给 BT-04模块
//  delay(1000);
//}

void loop() {
  if (Serial.available() > 0) {   // 这句在断开串口后，会出问题
    int responsedata = Serial.read();
    if (responsedata != -1) {

      //Serial.write(responsedata); // STM32 发送数据
      digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);              // wait for a second
      digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW

      // STM32 一直 等 BT04的数据
    }
  }
}
//
//void loop(){
//  if (Serial.available() > 0) {
//            digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
//        delay(1000);              // wait for a second
//        digitalWrite(PC13, LOW);
//}
//
//}
